package com.example.neusoft.yuejian_12.Activity;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.example.neusoft.yuejian_12.R;

public class MyCleanActivity extends AppCompatActivity {
    private Button button_my_clean;
    private TextView clean_number;
    private ImageButton myset_clean_back;
    private Context context = this;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_clean);
        myset_clean_back = (ImageButton) findViewById(R.id.myset_clean_back);
        myset_clean_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        button_my_clean = (Button) findViewById(R.id.button_my_clean);
        button_my_clean.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DataCleanManager.clearAllCache(context);
                try {
                    clean_number.setText(DataCleanManager.getTotalCacheSize(context));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        clean_number = (TextView) findViewById(R.id.clean_number);
        try {
            clean_number.setText(DataCleanManager.getTotalCacheSize(context));
        } catch (Exception e) {
            e.printStackTrace();
        }

    };
}
